package wei.zhang.algorithm;

import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;

import java.util.Arrays;
import java.util.Collection;

/**
 * 自定义范围分库
 */
public class RangeDSShardingAlgorithm  implements RangeShardingAlgorithm<Long> {
    public Collection<String> doSharding(Collection<String> availableTargetNames, RangeShardingValue<Long> shardingValue) {

        shardingValue.getValueRange().upperEndpoint(); // 上限
        shardingValue.getValueRange().lowerEndpoint(); // 下限
        String logicTableName = shardingValue.getLogicTableName(); //逻辑表
        return Arrays.asList("m1","m2");
    }
}
